package com.atguigu.service_edu.controller.front;


import com.atguigu.commonutils.R;
import com.atguigu.service_edu.entity.EduCourse;
import com.atguigu.service_edu.entity.EduTeacher;
import com.atguigu.service_edu.service.EduCourseService;
import com.atguigu.service_edu.service.EduTeacherService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.Cacheable;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/eduservice/indexfront")
public class IndexFrontController {

    @Autowired
    private EduCourseService courseService;

    @Autowired
    private EduTeacherService teacherService;

    //查询前8条课程,前4条讲师
    @GetMapping("/index")
    public R index(){

        List<EduCourse> eduCourseList = courseService.listLimit8();


        List<EduTeacher> eduTeacherList = teacherService.listLimit4();

        return R.ok().data("courseList",eduCourseList).data("teacherList",eduTeacherList);
    }
}
